import 'package:flutter/material.dart';
import 'package:flutter_boss/page/index.dart';

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ListView(
        children: <Widget>[
          _search(context),
        ],
      ),
    );
  }

  //搜索框
  _search(BuildContext context) {
    return Row(
      children: <Widget>[
        Padding(
          padding: EdgeInsets.only(top: 10.0),
          child: IconButton(
            icon: ImageIcon(
              NetworkImage(
                  "https://static.zhipin.com/zhipin/v125/h5/wap/images/icon-home.png"),
              size: 18.0,
              color: Color.fromRGBO(93, 213, 202, 1.0),
            ),
            onPressed: () {
              Navigator.of(context).push(MaterialPageRoute(
                  builder: (BuildContext context) => IndexPage()));
            },
          ),
        ),
        Expanded(
          child: Container(
            constraints: BoxConstraints(
              maxHeight: 18.0,
            ),
            child: TextField(
              decoration: InputDecoration(
                fillColor: Color.fromRGBO(244, 247, 249, 1.0),
                contentPadding: EdgeInsets.all(5.0),
                hintText: "搜索职位",
                hintStyle: TextStyle(
                  color: Color.fromRGBO(174, 174, 174, 1.0),
                ),
                border: OutlineInputBorder(
                  borderRadius: BorderRadius.all(Radius.circular(30.0)),
                ),
                prefixIcon: Container(
                  margin: EdgeInsets.only(left: 15.0),
                  child: DropdownButton(
                    items: [
                      DropdownMenuItem(
                        child: Text(
                          "武汉",
                          style: TextStyle(fontSize: 12.0),
                        ),
                      ),
                    ],
                    onChanged: (value) {},
                  ),
                ),
              ),
            ),
          ),
        ),
        Container(
          width: 60.0,
          height: 55.0,
          padding: EdgeInsets.only(top: 10),
          child: FlatButton(
            onPressed: () {},
            child: Text(
              "搜索",
              style: TextStyle(
                color: Color.fromRGBO(93, 213, 202, 1.0),
              ),
            ),
          ),
        )
      ],
    );
  }

  //筛选栏
  _filtrate(BuildContext context) {
    return Row(
      children: <Widget>[Expanded(child: null)],
    );
  }
}
